package dao;

import java.util.List;

import org.hibernate.Session;

import hbt.HibernateUtil;

public class HibernateDAO {
	
	private static HibernateDAO instancia;
	
	private HibernateDAO(){}
	
	public static HibernateDAO getInstancia() {
		if(instancia == null)
			instancia = new HibernateDAO();
		return instancia;
	}
	
	// Metodos
	
	public Object save(Object object){
		Session s = HibernateUtil.getSessionFactory().openSession();
		s.beginTransaction();
		s.save(object);
		s.getTransaction().commit();
		s.flush();
		//El id se devuelve en este objeto.
		return object;
	}
	
	
}
